<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - 样例</title>
	<script src="../../../angular.min.js"></script>
</head>
<body ng-app="">
	<div ng-controller="Controller">
		<form novalidate class="simple-form">
			Name: <input type="text" ng-model="user.name" /><br /> 
			E-mail: <input type="email" ng-model="user.email" /><br /> 
			性别: <input type="radio" ng-model="user.gender" value="male" /> 男 
			      <input type="radio" ng-model="user.gender" value="female" /> 女 
			<br/>
			<button ng-click="reset()">重置</button>
			<button ng-click="update(user)">保存</button>
		</form>
		<!-- 可以直接在{{}}中使用filter，跟在表达式后面用 | 分割,语法如下：{{ expression | filter1 | filter2...}}  -->
		<!-- 可以带参数，{{ expression | filter:argument1:argument2:... }} -->
		<pre>form = {{user | json}}</pre>
		<pre>master = {{master | json}}</pre>
	</div>

	<script>
		function Controller($scope) {
			$scope.master = {};
			$scope.update = function(user) {
				// Example with 1 argument
				$scope.master = angular.copy(user);
			};

			$scope.reset = function() {
				// Example with 2 arguments
				angular.copy($scope.master, $scope.user);
			};

			$scope.reset();
		}
	</script>
</body>
</html>